import { ApiCall } from "tsrpc";
import { ReqReady, ResReady } from "../../shared/protocols/worldServer/PtlReady";
import { WorldServerConn } from "../WorldServer";
import { SubWorldBilliards } from "../models/SubWorldBilliards";

export async function ApiReady(call: ApiCall<ReqReady, ResReady>) {
    // TODO
    const conn = call.conn as WorldServerConn;

    let current = conn.currentSubWorld as SubWorldBilliards;
    if(!current){
        return call.error('NO_TABLE');
    }

    current.onRPC_UserReady(call);
}